<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.2">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"eryangz.gitee.io","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"mac"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="极其好用的Python模块 tqdm Pendulum Pillow  tqdmtqdm在阿拉伯语中的意思是“进步”（taqadum , تقدّم），是西班牙语中“我非常爱你”的缩写（te quiero demasiado）。tqdm可以在长循环中添加一个进度提示信息，用户只需要封装任意的迭代器 tqdm(iterator)，是一个快速、扩展性强的进度条工具库。 tqdm.tqdm实现进度条12">
<meta property="og:type" content="article">
<meta property="og:title" content="极其好用的Python模块">
<meta property="og:url" content="https://eryangz.gitee.io/20211120/%E6%9E%81%E5%85%B6%E5%A5%BD%E7%94%A8%E7%9A%84Python%E6%A8%A1%E5%9D%97/index.html">
<meta property="og:site_name" content="二扬">
<meta property="og:description" content="极其好用的Python模块 tqdm Pendulum Pillow  tqdmtqdm在阿拉伯语中的意思是“进步”（taqadum , تقدّم），是西班牙语中“我非常爱你”的缩写（te quiero demasiado）。tqdm可以在长循环中添加一个进度提示信息，用户只需要封装任意的迭代器 tqdm(iterator)，是一个快速、扩展性强的进度条工具库。 tqdm.tqdm实现进度条12">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/eryangz/picgo/raw/master/demo.jpeg">
<meta property="og:image" content="https://gitee.com/eryangz/picgo/raw/master/image-20220316110300593.png">
<meta property="og:image" content="https://gitee.com/eryangz/picgo/raw/master/image-20220316110223642.png">
<meta property="og:image" content="c:/Users/longyuan/AppData/Roaming/Typora/typora-user-images/image-20220316110455499.png">
<meta property="og:image" content="https://gitee.com/eryangz/picgo/raw/master/image-20220316110631813.png">
<meta property="og:image" content="https://gitee.com/eryangz/picgo/raw/master/image-20220316112442426.png">
<meta property="og:image" content="https://gitee.com/eryangz/picgo/raw/master/image-20220316111239656.png">
<meta property="og:image" content="https://gitee.com/eryangz/picgo/raw/master/image-20220316111255645.png">
<meta property="og:image" content="https://gitee.com/eryangz/picgo/raw/master/image-20220316111306927.png">
<meta property="og:image" content="c:/Users/longyuan/AppData/Roaming/Typora/typora-user-images/image-20220316112101229.png">
<meta property="og:image" content="https://gitee.com/eryangz/picgo/raw/master/image-20220316112302012.png">
<meta property="og:image" content="https://gitee.com/eryangz/picgo/raw/master/image-20220316112320572.png">
<meta property="article:published_time" content="2021-11-20T12:20:56.000Z">
<meta property="article:modified_time" content="2023-05-20T09:56:51.936Z">
<meta property="article:author" content="二扬">
<meta property="article:tag" content="python">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/eryangz/picgo/raw/master/demo.jpeg">

<link rel="canonical" href="https://eryangz.gitee.io/20211120/%E6%9E%81%E5%85%B6%E5%A5%BD%E7%94%A8%E7%9A%84Python%E6%A8%A1%E5%9D%97/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>极其好用的Python模块 | 二扬</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">二扬</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">blog</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://eryangz.gitee.io/20211120/%E6%9E%81%E5%85%B6%E5%A5%BD%E7%94%A8%E7%9A%84Python%E6%A8%A1%E5%9D%97/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="二扬">
      <meta itemprop="description" content="念念不忘, 必有回响">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="二扬">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          极其好用的Python模块
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-11-20 20:20:56" itemprop="dateCreated datePublished" datetime="2021-11-20T20:20:56+08:00">2021-11-20</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2023-05-20 17:56:51" itemprop="dateModified" datetime="2023-05-20T17:56:51+08:00">2023-05-20</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/python/" itemprop="url" rel="index"><span itemprop="name">python</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="fa fa-file-word-o"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>10k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="fa fa-clock-o"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>9 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="极其好用的Python模块"><a href="#极其好用的Python模块" class="headerlink" title="极其好用的Python模块"></a>极其好用的Python模块</h1><ul>
<li>tqdm</li>
<li>Pendulum</li>
<li>Pillow</li>
</ul>
<h3 id="tqdm"><a href="#tqdm" class="headerlink" title="tqdm"></a>tqdm</h3><p><code>tqdm</code>在阿拉伯语中的意思是“进步”（taqadum , تقدّم），是西班牙语中“我非常爱你”的缩写（te quiero demasiado）。tqdm可以在长循环中添加一个进度提示信息，用户只需要封装任意的迭代器 tqdm(iterator)，是一个快速、扩展性强的进度条工具库。</p>
<h4 id="tqdm-tqdm实现进度条"><a href="#tqdm-tqdm实现进度条" class="headerlink" title="tqdm.tqdm实现进度条"></a>tqdm.tqdm实现进度条</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">tqdm()中传入可迭代对象</span></span><br><span class="line"><span class="string">默认参数:</span></span><br><span class="line"><span class="string">terable 可迭代对象</span></span><br><span class="line"><span class="string">desc    描述</span></span><br><span class="line"><span class="string">total   设定迭代次数</span></span><br><span class="line"><span class="string">leave(bool)   循环结束后是否保留进度提示信息， 默认为True</span></span><br><span class="line"><span class="string">ncols   进度条长度</span></span><br><span class="line"><span class="string">mininterval 进度条最小更新间隔</span></span><br><span class="line"><span class="string">maxinterval 进度条最大更新间隔</span></span><br><span class="line"><span class="string">unit    默认每秒迭代数</span></span><br><span class="line"><span class="string">postfix 后缀描述</span></span><br><span class="line"><span class="string">position    指定偏移</span></span><br><span class="line"><span class="string">bar_format  自定义进度条格式</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> tqdm(<span class="built_in">range</span>(<span class="number">20</span>)):</span><br><span class="line">    time.sleep(<span class="number">0.1</span>)</span><br><span class="line"><span class="comment"># 100%|██████████| 20/20 [00:02&lt;00:00,  9.93it/s]</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> tqdm([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>, <span class="number">8</span>, <span class="number">9</span>, <span class="number">10</span>]):</span><br><span class="line">    <span class="built_in">print</span>()</span><br><span class="line">    time.sleep(<span class="number">0.1</span>)</span><br><span class="line">    </span><br><span class="line"> <span class="comment"># 0%|          | 0/10 [00:00&lt;?, ?it/s]</span></span><br><span class="line"> <span class="comment"># 10%|█         | 1/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"> <span class="comment"># 20%|██        | 2/10 [00:00&lt;00:00,  9.92it/s]</span></span><br><span class="line"> <span class="comment"># 30%|███       | 3/10 [00:00&lt;00:00,  9.95it/s]</span></span><br><span class="line"> <span class="comment"># 40%|████      | 4/10 [00:00&lt;00:00,  9.94it/s]</span></span><br><span class="line"> <span class="comment"># 50%|█████     | 5/10 [00:00&lt;00:00,  9.94it/s]</span></span><br><span class="line"> <span class="comment"># 60%|██████    | 6/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"> <span class="comment"># 80%|████████  | 8/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"> <span class="comment"># 90%|█████████ | 9/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"> <span class="comment">#100%|██████████| 10/10 [00:01&lt;00:00,  9.93it/s]</span></span><br></pre></td></tr></table></figure>
<h4 id="tqdm-trange实现进度条"><a href="#tqdm-trange实现进度条" class="headerlink" title="tqdm.trange实现进度条"></a>tqdm.trange实现进度条</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># trange(i) == tqdm(range(i)), 传入参数正整数</span></span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> trange(<span class="number">20</span>):</span><br><span class="line">    time.sleep(<span class="number">0.1</span>)</span><br><span class="line"><span class="number">100</span>%|██████████| <span class="number">20</span>/<span class="number">20</span> [<span class="number">00</span>:02&lt;<span class="number">00</span>:<span class="number">00</span>,  <span class="number">9.93</span>it/s]</span><br></pre></td></tr></table></figure>

<h4 id="自定义消息描述-进度条消息前缀"><a href="#自定义消息描述-进度条消息前缀" class="headerlink" title="自定义消息描述(进度条消息前缀)"></a>自定义消息描述(进度条消息前缀)</h4><ul>
<li><p>方式一</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># pbar = trange(10)		</span></span><br><span class="line">pbar = tqdm(<span class="built_in">range</span>(<span class="number">10</span>))</span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> pbar:</span><br><span class="line">    <span class="built_in">print</span>()</span><br><span class="line">    pbar.set_description(<span class="string">f&#x27;Processing<span class="subst">&#123;i&#125;</span>&#x27;</span>)</span><br><span class="line">    time.sleep(<span class="number">0.1</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># Processing0:   0%|          | 0/10 [00:00&lt;?, ?it/s]</span></span><br><span class="line"><span class="comment"># Processing1:  10%|█         | 1/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># Processing3:  30%|███       | 3/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># Processing5:  50%|█████     | 5/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># Processing6:  60%|██████    | 6/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># Processing7:  70%|███████   | 7/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># Processing8:  80%|████████  | 8/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># Processing9:  90%|█████████ | 9/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># Processing9: 100%|██████████| 10/10 [00:01&lt;00:00,  9.93it/s]</span></span><br></pre></td></tr></table></figure></li>
<li><p>方式二</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># for i in tqdm(range(10), desc=&#x27;list loop&#x27;):</span></span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> trange(<span class="number">10</span>, desc=<span class="string">&#x27;list loop&#x27;</span>):</span><br><span class="line">    <span class="built_in">print</span>()</span><br><span class="line">    time.sleep(<span class="number">0.1</span>)</span><br><span class="line">    </span><br><span class="line"><span class="comment"># list loop:   0%|          | 0/10 [00:00&lt;?, ?it/s]</span></span><br><span class="line"><span class="comment"># list loop:  10%|█         | 1/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># list loop:  20%|██        | 2/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># list loop:  30%|███       | 3/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># list loop:  50%|█████     | 5/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># list loop:  60%|██████    | 6/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># list loop:  70%|███████   | 7/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># list loop:  80%|████████  | 8/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># list loop:  90%|█████████ | 9/10 [00:00&lt;00:00,  9.93it/s]</span></span><br><span class="line"><span class="comment"># list loop: 100%|██████████| 10/10 [00:01&lt;00:00,  9.93it/s]</span></span><br></pre></td></tr></table></figure></li>
</ul>
<h4 id="自定义进度条消息组成"><a href="#自定义进度条消息组成" class="headerlink" title="自定义进度条消息组成"></a>自定义进度条消息组成</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">默认进度条消息有以下参数构成</span></span><br><span class="line"><span class="string">percentage  百分比</span></span><br><span class="line"><span class="string">n_fmt   当前数</span></span><br><span class="line"><span class="string">total_fmt   总数</span></span><br><span class="line"><span class="string">elapsed 消耗的时间</span></span><br><span class="line"><span class="string">remaining   剩余的时间</span></span><br><span class="line"><span class="string">rate_fmt    速率</span></span><br><span class="line"><span class="string">postifx 后缀描述 默认为none</span></span><br><span class="line"><span class="string">desc    描述  默认为none</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line">bar_format = <span class="string">&#x27;&#123;desc&#125;: &#123;postfix&#125;: &#123;percentage&#125;: &#123;n_fmt&#125;: &#123;total_fmt&#125;&#x27;</span></span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> tqdm(<span class="built_in">range</span>(<span class="number">5</span>), desc=<span class="string">&#x27;test&#x27;</span>, bar_format=bar_format, postfix=<span class="string">&#x27;haha&#x27;</span>):</span><br><span class="line">    <span class="built_in">print</span>()</span><br><span class="line">    time.sleep(<span class="number">0.1</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># test: , haha: 0.0: 0: 5</span></span><br><span class="line"><span class="comment"># test: , haha: 20.0: 1: 5</span></span><br><span class="line"><span class="comment"># test: , haha: 40.0: 2: 5</span></span><br><span class="line"><span class="comment"># test: , haha: 80.0: 4: 5</span></span><br><span class="line"><span class="comment"># test: , haha: 100.0: 5: 5</span></span><br></pre></td></tr></table></figure>

<h4 id="手动控制进度条"><a href="#手动控制进度条" class="headerlink" title="手动控制进度条"></a>手动控制进度条</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># pbar = tqdm(total=10)</span></span><br><span class="line"><span class="comment"># for i in range(10):</span></span><br><span class="line"><span class="comment">#     print()</span></span><br><span class="line"><span class="comment">#     if i % 2:</span></span><br><span class="line"><span class="comment">#         pbar.update(1)</span></span><br><span class="line"><span class="comment">#     time.sleep(0.1)</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">with</span> tqdm(total=<span class="number">10</span>) <span class="keyword">as</span> f:</span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">10</span>):</span><br><span class="line">        <span class="built_in">print</span>()</span><br><span class="line">        <span class="keyword">if</span> i % <span class="number">2</span>:</span><br><span class="line">            f.update(<span class="number">1</span>)</span><br><span class="line">        time.sleep(<span class="number">0.1</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 10%|█         | 1/10 [00:01&lt;00:09,  1.00s/it]</span></span><br><span class="line"><span class="comment"># 20%|██        | 2/10 [00:03&lt;00:12,  1.59s/it]</span></span><br><span class="line"><span class="comment"># 30%|███       | 3/10 [00:05&lt;00:12,  1.78s/it]</span></span><br><span class="line"><span class="comment"># 40%|████      | 4/10 [00:07&lt;00:11,  1.87s/it]</span></span><br><span class="line"><span class="comment"># 50%|█████     | 5/10 [00:09&lt;00:09,  1.91s/it]</span></span><br><span class="line"><span class="comment"># 50%|█████     | 5/10 [00:10&lt;00:10,  2.00s/it]</span></span><br></pre></td></tr></table></figure>

<h4 id="手动定义进度条"><a href="#手动定义进度条" class="headerlink" title="手动定义进度条"></a>手动定义进度条</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> time</span><br><span class="line"></span><br><span class="line"><span class="built_in">print</span>(<span class="string">&quot;程序启动中,请稍等:&quot;</span>)</span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">26</span>):</span><br><span class="line">    a = <span class="string">&quot;🤩&quot;</span> * i</span><br><span class="line">    b = <span class="string">&quot;⚪&quot;</span> * (<span class="number">25</span> - i)</span><br><span class="line">    c = (i / <span class="number">25</span>) * <span class="number">25</span> * <span class="number">4</span></span><br><span class="line">    <span class="built_in">print</span>(<span class="string">&quot;\r&#123;&#125;&#123;&#125;&#123;:.2f&#125;%&quot;</span>.<span class="built_in">format</span>(a, b, c), sep=<span class="string">&quot;\n&quot;</span>)	<span class="comment"># 百分比格式化展示</span></span><br><span class="line">    time.sleep(<span class="number">0.1</span>)</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"># 输出信息</span><br><span class="line">程序启动中,请稍等:</span><br><span class="line">⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪0.00%</span><br><span class="line">🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪4.00%</span><br><span class="line">🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪8.00%</span><br><span class="line">🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪12.00%</span><br><span class="line">🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪16.00%</span><br><span class="line">🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪20.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪24.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪28.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪32.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪36.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪40.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪44.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪48.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪52.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪56.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪⚪60.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪⚪64.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪⚪68.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪⚪72.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪⚪76.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪⚪80.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪⚪84.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪⚪88.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪⚪92.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩⚪96.00%</span><br><span class="line">🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩🤩100.00%</span><br></pre></td></tr></table></figure>

<h3 id="Pendulum"><a href="#Pendulum" class="headerlink" title="Pendulum"></a>Pendulum</h3><p><code>pendulum</code>模块是用来处理日期、时间的，对于处理时区的日期、时间比较方便, 继承了datetime对象，datetime有的方法都能用</p>
<h4 id="可以直接替换datetime"><a href="#可以直接替换datetime" class="headerlink" title="可以直接替换datetime"></a>可以直接替换datetime</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">now_day = pendulum.datetime(<span class="number">2022</span>, <span class="number">3</span>, <span class="number">3</span>)</span><br><span class="line"><span class="built_in">print</span>(<span class="built_in">isinstance</span>(now_day, datetime.datetime))	<span class="comment"># True</span></span><br></pre></td></tr></table></figure>

<h4 id="时区处理"><a href="#时区处理" class="headerlink" title="时区处理"></a>时区处理</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 得到某一时区时间</span></span><br><span class="line">now_in_sh = pendulum.now(<span class="string">&#x27;Asia/Shanghai&#x27;</span>)</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&#x27;上海时间：<span class="subst">&#123;now_in_sh&#125;</span>&#x27;</span>)	<span class="comment"># 上海时间：2022-03-15T16:17:14.840324+08:00</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 时间比较</span></span><br><span class="line">now_in_sh_dt = pendulum.datetime(<span class="number">2022</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">23</span>, <span class="number">00</span>, <span class="number">00</span>, tz=<span class="string">&#x27;asia/Shanghai&#x27;</span>)</span><br><span class="line">now_in_dt = pendulum.datetime(<span class="number">2022</span>, <span class="number">3</span>, <span class="number">8</span>, <span class="number">10</span>, <span class="number">00</span>, <span class="number">00</span>, tz=<span class="string">&#x27;asia/Shanghai&#x27;</span>)</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&#x27;天数比较： <span class="subst">&#123;now_in_sh_dt.diff(now_in_dt).in_days()&#125;</span> 小时比较: <span class="subst">&#123;now_in_sh_dt.diff(now_in_dt).in_hours()&#125;</span>&#x27;</span>)	</span><br><span class="line"><span class="comment"># 天数比较： 5 小时比较: 107</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;当前上海时间: <span class="subst">&#123;now_in_sh.in_timezone(<span class="string">&#x27;asia/Shanghai&#x27;</span>)&#125;</span> 当前美国东部时间: <span class="subst">&#123;now_in_sh.in_timezone(<span class="string">&#x27;US/Eastern&#x27;</span>)&#125;</span>&quot;</span>) </span><br><span class="line"><span class="comment"># 当前上海时间: 2022-03-15T16:19:38.787739+08:00 当前美国东部时间: 2022-03-15T04:19:38.787739-04:00</span></span><br></pre></td></tr></table></figure>

<h4 id="时间字符解析"><a href="#时间字符解析" class="headerlink" title="时间字符解析"></a>时间字符解析</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">format_time = pendulum.from_format(<span class="string">&#x27;2022-02-01 22:00:00&#x27;</span>, <span class="string">&#x27;YYYY-MM-DD HH:mm:ss&#x27;</span>)</span><br><span class="line">num_type = pendulum.parse(<span class="string">&#x27;20220201&#x27;</span>)	<span class="comment"># 时间数字</span></span><br><span class="line">ISO_RFC = pendulum.parse(<span class="string">&#x27;2022-02-01T07:20:50.52Z&#x27;</span>)  <span class="comment"># ISO 8601格式</span></span><br><span class="line">RFC_str = pendulum.parse(<span class="string">&#x27;2022-02-01 07:20:50.52Z&#x27;</span>)	<span class="comment"># RFC 3339格式</span></span><br><span class="line"><span class="built_in">print</span>(format_time, num_type, ISO_RFC, RFC_str, sep=<span class="string">&#x27;\n&#x27;</span>)</span><br><span class="line"><span class="built_in">print</span>(<span class="built_in">type</span>(format_time), <span class="built_in">type</span>(num_type), <span class="built_in">type</span>(ISO_RFC), <span class="built_in">type</span>(RFC_str), sep=<span class="string">&#x27;&#x27;</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 2022-02-01T22:00:00+00:00</span></span><br><span class="line"><span class="comment"># 2022-02-01T00:00:00+00:00</span></span><br><span class="line"><span class="comment"># 2022-02-01T07:20:50.520000+00:00</span></span><br><span class="line"><span class="comment"># 2022-02-01T07:20:50.520000+00:00</span></span><br><span class="line"><span class="comment"># &lt;class &#x27;pendulum.datetime.DateTime&#x27;&gt;&lt;class &#x27;pendulum.datetime.DateTime&#x27;&gt;&lt;class &#x27;pendulum.datetime.DateTime&#x27;&gt;&lt;class &#x27;pendulum.datetime.DateTime&#x27;&gt;</span></span><br></pre></td></tr></table></figure>

<h4 id="字符串格式化"><a href="#字符串格式化" class="headerlink" title="字符串格式化"></a>字符串格式化</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">dt = pendulum.datetime(<span class="number">2022</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">23</span>, <span class="number">30</span>, <span class="number">00</span>)</span><br><span class="line">date_now = dt.to_date_string()		<span class="comment"># 2022-01-28</span></span><br><span class="line">time_now = dt.to_time_string()		<span class="comment"># 18:32:33</span></span><br><span class="line">datetime_now = dt.to_datetime_string()		<span class="comment"># 2022-01-28 18:32:33</span></span><br><span class="line">datetime_now2 = dt.to_day_datetime_string()		<span class="comment"># Fri, Jan 28, 2022 6:32 PM</span></span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&#x27;dt: <span class="subst">&#123;dt&#125;</span> 当前日期：<span class="subst">&#123;date_now&#125;</span> 当前时间：<span class="subst">&#123;time_now&#125;</span> 当前日期时间：<span class="subst">&#123;datetime_now&#125;</span> 当前时间日期<span class="subst">&#123;datetime_now2&#125;</span>&#x27;</span>)</span><br><span class="line"><span class="comment"># dt: 2022-03-03T23:30:00+00:00 当前日期：2022-03-03 当前时间：23:30:00 当前日期时间：2022-03-03 23:30:00 当前时间日期Thu, Mar 3, 2022 11:30 PM</span></span><br></pre></td></tr></table></figure>

<h4 id="快速获取常用时间日期"><a href="#快速获取常用时间日期" class="headerlink" title="快速获取常用时间日期"></a>快速获取常用时间日期</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 得到昨天、今天、明天日期</span></span><br><span class="line">d1 = pendulum.yesterday()  <span class="comment"># 昨天</span></span><br><span class="line">d2 = pendulum.today()  <span class="comment"># 今天</span></span><br><span class="line">d3 = pendulum.tomorrow()  <span class="comment"># 明天</span></span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&#x27;昨天: <span class="subst">&#123;d1&#125;</span> 今天: <span class="subst">&#123;d2&#125;</span> 明天: <span class="subst">&#123;d3&#125;</span>&#x27;</span>)</span><br><span class="line"><span class="comment"># 昨天: 2022-03-14T00:00:00+08:00 今天: 2022-03-15T00:00:00+08:00 明天: 2022-03-16T00:00:00+08:00</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 获取凌晨、月初等</span></span><br><span class="line">now_time_dt = pendulum.now()</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;当前时间: <span class="subst">&#123;now_time_dt&#125;</span> \n凌晨: <span class="subst">&#123;now_time_dt.start_of(<span class="string">&#x27;day&#x27;</span>)&#125;</span> \n午夜: <span class="subst">&#123;now_time_dt.end_of(<span class="string">&#x27;day&#x27;</span>)&#125;</span>&quot;</span>)</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;月初: <span class="subst">&#123;now_time_dt.start_of(<span class="string">&#x27;month&#x27;</span>)&#125;</span> \n年初: <span class="subst">&#123;now_time_dt.start_of(<span class="string">&#x27;year&#x27;</span>)&#125;</span>&quot;</span>)</span><br><span class="line"><span class="comment"># 当前时间: 2022-03-15T16:29:58.086806+08:00 </span></span><br><span class="line"><span class="comment"># 凌晨: 2022-03-15T00:00:00+08:00 </span></span><br><span class="line"><span class="comment"># 午夜: 2022-03-15T23:59:59.999999+08:00</span></span><br><span class="line"><span class="comment"># 月初: 2022-03-01T00:00:00+08:00 </span></span><br><span class="line"><span class="comment"># 年初: 2022-01-01T00:00:00+08:00</span></span><br></pre></td></tr></table></figure>

<h4 id="时间日期加减"><a href="#时间日期加减" class="headerlink" title="时间日期加减"></a>时间日期加减</h4><ul>
<li>时间数据上进行加、减：<code>add</code>和<code>subtract</code><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">dt = pendulum.datetime(<span class="number">2022</span>, <span class="number">3</span>, <span class="number">3</span>)  <span class="comment"># 2022-03-03T00:00:00+00:00</span></span><br><span class="line">dt_years_add = dt.add(years=<span class="number">5</span>)  <span class="comment"># 2027-03-03T00:00:00+00:00</span></span><br><span class="line">dt_years_subtract = dt.subtract(years=<span class="number">1</span>)  <span class="comment"># 2021-03-03T00:00:00+00:00</span></span><br><span class="line">dt_month_add = dt.add(months=<span class="number">60</span>)  <span class="comment"># 2027-03-03T00:00:00+00:00</span></span><br><span class="line">dt_month_subtract = dt.subtract(months=<span class="number">60</span>)  <span class="comment"># 2017-03-03T00:00:00+00:00</span></span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&#x27;当前时间: <span class="subst">&#123;dt&#125;</span> \n五年后：<span class="subst">&#123;dt_years_add&#125;</span> \n一年前：<span class="subst">&#123;dt_years_subtract&#125;</span> &#x27;</span></span><br><span class="line">      <span class="string">f&#x27;\n60个月后: <span class="subst">&#123;dt_month_add&#125;</span> \n六十个月前: <span class="subst">&#123;dt_month_subtract&#125;</span>&#x27;</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 当前时间: 2022-03-03T00:00:00+00:00 </span></span><br><span class="line"><span class="comment"># 五年后：2027-03-03T00:00:00+00:00 </span></span><br><span class="line"><span class="comment"># 一年前：2021-03-03T00:00:00+00:00 </span></span><br><span class="line"><span class="comment"># 60个月后: 2027-03-03T00:00:00+00:00 </span></span><br><span class="line"><span class="comment"># 六十个月前: 2017-03-03T00:00:00+00:00</span></span><br></pre></td></tr></table></figure></li>
</ul>
<h4 id="人性化输出"><a href="#人性化输出" class="headerlink" title="人性化输出"></a>人性化输出</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">人性化时间的输出功能。</span></span><br><span class="line"><span class="string">如果平时用搜素引擎的话，就会看到有很多内容的时间被标成了“1天前”、“1周后”等等，这个在`pendulum`模块当中也能够实现</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line">one_day_ago = pendulum.now().subtract(days=<span class="number">1</span>).diff_for_humans()</span><br><span class="line">one_year_ago = pendulum.now().diff_for_humans(pendulum.now().subtract(years=<span class="number">1</span>))</span><br><span class="line">one_minute_after = pendulum.now().add(minutes=<span class="number">1</span>).diff_for_humans()</span><br><span class="line">someday = pendulum.datetime(<span class="number">2022</span>, <span class="number">1</span>, <span class="number">1</span>).diff_for_humans()</span><br><span class="line"></span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&#x27;一天前: <span class="subst">&#123;one_day_ago&#125;</span>  一年前: <span class="subst">&#123;one_year_ago&#125;</span>  一分钟后: <span class="subst">&#123;one_minute_after&#125;</span>  某一天: <span class="subst">&#123;someday&#125;</span>&#x27;</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 切换到中文模式</span></span><br><span class="line"><span class="built_in">print</span>(pendulum.now().subtract(days=<span class="number">14</span>).diff_for_humans(locale=<span class="string">&#x27;zh&#x27;</span>))  <span class="comment"># 2周前</span></span><br><span class="line"><span class="built_in">print</span>(pendulum.now().add(seconds=<span class="number">5</span>).diff_for_humans(locale=<span class="string">&#x27;zh&#x27;</span>))  <span class="comment"># 5秒钟后</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 快速获取年龄</span></span><br><span class="line">age = pendulum.datetime(<span class="number">1996</span>, <span class="number">11</span>, <span class="number">15</span>, <span class="number">16</span>, <span class="number">20</span>, <span class="number">20</span>).age</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&#x27;1996年11月15日出生的年龄为: <span class="subst">&#123;age&#125;</span>&#x27;</span>)	<span class="comment"># 1996年11月15日出生的年龄为: 25</span></span><br></pre></td></tr></table></figure>

<h3 id="Pillow"><a href="#Pillow" class="headerlink" title="Pillow"></a>Pillow</h3><p><code>PIL(Python Imaging Library)</code>是<code>Python</code>一个强大方便的图像处理库，<code>Pillow</code>是<code>PIL</code>的一个派生分支，但如今已经发展成为比<code>PIL</code>本身更具活力的图像处理库。Pillow中最为重要的是Image类，读取和处理图像都要通过这个类来完成，以下为<code>pillow</code>库的简单使用</p>
<h4 id="剪裁图像"><a href="#剪裁图像" class="headerlink" title="剪裁图像"></a>剪裁图像</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 加载图片显示</span></span><br><span class="line">image = Image.<span class="built_in">open</span>(<span class="string">&#x27;./img/demo.jpeg&#x27;</span>)</span><br><span class="line">image.show()</span><br></pre></td></tr></table></figure>
<p><img src="https://gitee.com/eryangz/picgo/raw/master/demo.jpeg" alt="demo"></p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 裁剪图片</span></span><br><span class="line">rect = <span class="number">80</span>, <span class="number">20</span>, <span class="number">310</span>, <span class="number">360</span></span><br><span class="line">crop_after = image.crop(rect)</span><br><span class="line"><span class="built_in">print</span>(crop_after.size, crop_after.mode) <span class="comment"># (230, 340) RGB</span></span><br><span class="line">crop_after.show()</span><br></pre></td></tr></table></figure>
<p><img src="https://gitee.com/eryangz/picgo/raw/master/image-20220316110300593.png" alt="image-20220316110300593"></p>
<h4 id="生成缩略图"><a href="#生成缩略图" class="headerlink" title="生成缩略图"></a>生成缩略图</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">size = <span class="number">128</span>, <span class="number">128</span></span><br><span class="line">image.thumbnail(size)</span><br></pre></td></tr></table></figure>
<p><img src="https://gitee.com/eryangz/picgo/raw/master/image-20220316110223642.png" alt="image-20220316110223642"></p>
<h4 id="缩放和黏贴图像"><a href="#缩放和黏贴图像" class="headerlink" title="缩放和黏贴图像"></a>缩放和黏贴图像</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">image2 = Image.<span class="built_in">open</span>(<span class="string">&#x27;./img/cat.jpeg&#x27;</span>)</span><br><span class="line">image2.show()</span><br></pre></td></tr></table></figure>
<p><img src="C:\Users\longyuan\AppData\Roaming\Typora\typora-user-images\image-20220316110455499.png" alt="image-20220316110455499"></p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">rect = <span class="number">460</span>, <span class="number">330</span>, <span class="number">750</span>, <span class="number">520</span></span><br><span class="line">guido_head = image2.crop(rect)	<span class="comment"># 裁剪</span></span><br><span class="line">width, height = guido_head.size</span><br><span class="line">guido_head.show()	</span><br></pre></td></tr></table></figure>
<p><img src="https://gitee.com/eryangz/picgo/raw/master/image-20220316110631813.png" alt="image-20220316110631813"></p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">guido_head_resize = guido_head.resize((<span class="built_in">int</span>(width / <span class="number">1.5</span>), <span class="built_in">int</span>(height / <span class="number">1.5</span>)))</span><br><span class="line">image.paste(guido_head_resize, (<span class="number">460</span>, <span class="number">330</span>))	<span class="comment"># 黏贴</span></span><br><span class="line">image.show()</span><br></pre></td></tr></table></figure>
<p><img src="https://gitee.com/eryangz/picgo/raw/master/image-20220316112442426.png" alt="image-20220316112442426"></p>
<h4 id="旋转和翻转"><a href="#旋转和翻转" class="headerlink" title="旋转和翻转"></a>旋转和翻转</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">image = Image.<span class="built_in">open</span>(<span class="string">&#x27;./img/cat.jpeg&#x27;</span>)</span><br><span class="line">image.show()	</span><br><span class="line">image.rotate(<span class="number">90</span>).show()	</span><br><span class="line">image.transpose(Image.FLIP_LEFT_RIGHT).show()	<span class="comment"># 水平翻转</span></span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/eryangz/picgo/raw/master/image-20220316111239656.png" alt="image-20220316111239656"></p>
<p><img src="https://gitee.com/eryangz/picgo/raw/master/image-20220316111255645.png" alt="image-20220316111255645"></p>
<p><img src="https://gitee.com/eryangz/picgo/raw/master/image-20220316111306927.png" alt="image-20220316111306927"></p>
<h4 id="操作像素"><a href="#操作像素" class="headerlink" title="操作像素"></a>操作像素</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">image = Image.<span class="built_in">open</span>(<span class="string">&#x27;./img/demo.jpeg&#x27;</span>)</span><br><span class="line"><span class="keyword">for</span> x <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">400</span>, <span class="number">500</span>):</span><br><span class="line">   <span class="keyword">for</span> y <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">400</span>, <span class="number">500</span>):</span><br><span class="line">      image.putpixel((x, y), (<span class="number">128</span>, <span class="number">0</span>, <span class="number">128</span>, <span class="number">255</span>))</span><br></pre></td></tr></table></figure>
<p><img src="C:\Users\longyuan\AppData\Roaming\Typora\typora-user-images\image-20220316112101229.png" alt="image-20220316112101229"></p>
<h4 id="滤镜"><a href="#滤镜" class="headerlink" title="滤镜"></a>滤镜</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">image = Image.<span class="built_in">open</span>(<span class="string">&#x27;./img/demo.jpeg&#x27;</span>)</span><br><span class="line">image.<span class="built_in">filter</span>(ImageFilter.CONTOUR).show()  <span class="comment"># 轮廓滤波</span></span><br><span class="line">image.<span class="built_in">filter</span>(ImageFilter.GaussianBlur).show()   <span class="comment"># 高斯模糊</span></span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/eryangz/picgo/raw/master/image-20220316112302012.png" alt="image-20220316112302012"></p>
<p><img src="https://gitee.com/eryangz/picgo/raw/master/image-20220316112320572.png" alt="image-20220316112320572"></p>

    </div>

    
    
    
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>二扬
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://eryangz.gitee.io/20211120/%E6%9E%81%E5%85%B6%E5%A5%BD%E7%94%A8%E7%9A%84Python%E6%A8%A1%E5%9D%97/" title="极其好用的Python模块">https://eryangz.gitee.io/20211120/极其好用的Python模块/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_blank"><i class="fa fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/tags/python/" rel="tag"><i class="fa fa-tag"></i> python</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/20210903/ubuntu%E8%A7%86%E9%A2%91%E6%B5%81%E8%BD%AC%E6%8D%A2/" rel="prev" title="ubuntu视频流转换">
      <i class="fa fa-chevron-left"></i> ubuntu视频流转换
    </a></div>
      <div class="post-nav-item">
    <a href="/20211120/FLASK%E5%B8%B8%E7%94%A8%E5%BA%93%E5%92%8C%E6%8F%92%E4%BB%B6/" rel="next" title="FLASK常用库和插件">
      FLASK常用库和插件 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%9E%81%E5%85%B6%E5%A5%BD%E7%94%A8%E7%9A%84Python%E6%A8%A1%E5%9D%97"><span class="nav-text">极其好用的Python模块</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#tqdm"><span class="nav-text">tqdm</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#tqdm-tqdm%E5%AE%9E%E7%8E%B0%E8%BF%9B%E5%BA%A6%E6%9D%A1"><span class="nav-text">tqdm.tqdm实现进度条</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#tqdm-trange%E5%AE%9E%E7%8E%B0%E8%BF%9B%E5%BA%A6%E6%9D%A1"><span class="nav-text">tqdm.trange实现进度条</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%B6%88%E6%81%AF%E6%8F%8F%E8%BF%B0-%E8%BF%9B%E5%BA%A6%E6%9D%A1%E6%B6%88%E6%81%AF%E5%89%8D%E7%BC%80"><span class="nav-text">自定义消息描述(进度条消息前缀)</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%BF%9B%E5%BA%A6%E6%9D%A1%E6%B6%88%E6%81%AF%E7%BB%84%E6%88%90"><span class="nav-text">自定义进度条消息组成</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%89%8B%E5%8A%A8%E6%8E%A7%E5%88%B6%E8%BF%9B%E5%BA%A6%E6%9D%A1"><span class="nav-text">手动控制进度条</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%89%8B%E5%8A%A8%E5%AE%9A%E4%B9%89%E8%BF%9B%E5%BA%A6%E6%9D%A1"><span class="nav-text">手动定义进度条</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Pendulum"><span class="nav-text">Pendulum</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%8F%AF%E4%BB%A5%E7%9B%B4%E6%8E%A5%E6%9B%BF%E6%8D%A2datetime"><span class="nav-text">可以直接替换datetime</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%97%B6%E5%8C%BA%E5%A4%84%E7%90%86"><span class="nav-text">时区处理</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%97%B6%E9%97%B4%E5%AD%97%E7%AC%A6%E8%A7%A3%E6%9E%90"><span class="nav-text">时间字符解析</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%A0%BC%E5%BC%8F%E5%8C%96"><span class="nav-text">字符串格式化</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%BF%AB%E9%80%9F%E8%8E%B7%E5%8F%96%E5%B8%B8%E7%94%A8%E6%97%B6%E9%97%B4%E6%97%A5%E6%9C%9F"><span class="nav-text">快速获取常用时间日期</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%97%B6%E9%97%B4%E6%97%A5%E6%9C%9F%E5%8A%A0%E5%87%8F"><span class="nav-text">时间日期加减</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E4%BA%BA%E6%80%A7%E5%8C%96%E8%BE%93%E5%87%BA"><span class="nav-text">人性化输出</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Pillow"><span class="nav-text">Pillow</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%89%AA%E8%A3%81%E5%9B%BE%E5%83%8F"><span class="nav-text">剪裁图像</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E7%94%9F%E6%88%90%E7%BC%A9%E7%95%A5%E5%9B%BE"><span class="nav-text">生成缩略图</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E7%BC%A9%E6%94%BE%E5%92%8C%E9%BB%8F%E8%B4%B4%E5%9B%BE%E5%83%8F"><span class="nav-text">缩放和黏贴图像</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%97%8B%E8%BD%AC%E5%92%8C%E7%BF%BB%E8%BD%AC"><span class="nav-text">旋转和翻转</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%93%8D%E4%BD%9C%E5%83%8F%E7%B4%A0"><span class="nav-text">操作像素</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%BB%A4%E9%95%9C"><span class="nav-text">滤镜</span></a></li></ol></li></ol></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="二扬"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">二扬</p>
  <div class="site-description" itemprop="description">念念不忘, 必有回响</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">26</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">27</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/EryangZzz" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;EryangZzz" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://gitee.com/" title="Gitee → https:&#x2F;&#x2F;gitee.com&#x2F;" rel="noopener" target="_blank"><i class="fa fa-fw fa-github-alt"></i>Gitee</a>
      </span>
      <span class="links-of-author-item">
        <a href="/1289256052" title="QQ → 1289256052"><i class="fa fa-fw fa-qq"></i>QQ</a>
      </span>
      <span class="links-of-author-item">
        <a href="/1289256052@qq.com" title="E-Mail → 1289256052@qq.com"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
  </div>



<script type="text/javascript" charset="utf-8" src="/js/tagcloud.js"></script>
<script type="text/javascript" charset="utf-8" src="/js/tagcanvas.js"></script>
<div class="widget-wrap">
    <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=110 src="//music.163.com/outchain/player?type=0&id=8435349308&auto=1&height=66"></iframe>
    <h3 class="widget-title">标签云</h3>
    <div id="myCanvasContainer" class="widget tagcloud">
        <canvas width="250" height="250" id="resCanvas" style="width=100%">
            <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/emqx/" rel="tag">emqx</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flask/" rel="tag">flask</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/" rel="tag">git</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/js/" rel="tag">js</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/metaclass/" rel="tag">metaclass</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mqtt/" rel="tag">mqtt</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nginx/" rel="tag">nginx</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/odoo/" rel="tag">odoo</a><span class="tag-list-count">10</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/odoo%E5%89%8D%E7%AB%AF/" rel="tag">odoo前端</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/odoo%E9%83%A8%E7%BD%B2/" rel="tag">odoo部署</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/office%E9%A2%84%E8%A7%88/" rel="tag">office预览</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pgsql/" rel="tag">pgsql</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pip%E6%BA%90/" rel="tag">pip源</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pyinstaller/" rel="tag">pyinstaller</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/" rel="tag">python</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/re/" rel="tag">re</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rtsp/" rel="tag">rtsp</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/time%E6%A8%A1%E5%9D%97/" rel="tag">time模块</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ubuntu/" rel="tag">ubuntu</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ubuntu%E6%BA%90/" rel="tag">ubuntu源</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%85%83%E7%B1%BB/" rel="tag">元类</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%A4%9A%E7%BA%BF%E7%A8%8B/" rel="tag">多线程</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%9C%8D%E5%8A%A1%E9%85%8D%E7%BD%AE/" rel="tag">服务配置</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F/" rel="tag">正则表达式</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%AC%91%E8%84%B8%E4%BA%A4%E4%BA%92/" rel="tag">笑脸交互</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%A7%86%E9%A2%91%E6%B5%81/" rel="tag">视频流</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" rel="tag">设计模式</a><span class="tag-list-count">1</span></li></ul>
        </canvas>
    </div>
</div>




      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">二扬</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
      <span class="post-meta-item-text">站点总字数：</span>
    <span title="站点总字数">105k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span class="post-meta-item-text">站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">1:35</span>
</div>



        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  
  <script>
    (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      bp.src = (curProtocol === 'https') ? 'https://zz.bdstatic.com/linksubmit/push.js' : 'http://push.zhanzhang.baidu.com/push.js';
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
    })();
  </script>
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
 var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>





  
<script src="/js/local-search.js"></script>













  

  

</body>
</html>
